package containers;

import java.util.concurrent.CopyOnWriteArrayList;

import casino.Casino;
import casino.GameCard;
import casino.Player;


public class SortedHand extends Hand {
	
	public SortedHand(Casino n, Player p, int x, int y, int w, CopyOnWriteArrayList<GameCard> c){
		 super(n,p,x,y,w,c);
	 }
	 
	 public SortedHand(Casino n, Player p, int x, int y, int w){
		 super(n,p,x,y,w);
	 }
	 
	 public void sort(){
		 int i = 0;
		 while(i < cards.size()-1){
			 if(cards.get(i).value.ordinal() > cards.get(i+1).value.ordinal()){
				 cards.set(i, cards.set(i+1, cards.get(i)));
				 if(i > 0){
					 i--;
				 }
			 }else{
				 i++;
			 }
		 }
	 }
}
